//
// Created by tang on 2022/8/3.
//
#include "event/events.hpp"

extern const char *g_app_tab_names[AppEvent::SelectTabEvent::eTabIdCount];

namespace AppEvent {
    SelectTabEvent SelectTabEvent::fromTabName (const std::string &name)
    {
        for (int i=0; i<eTabIdCount; ++i) {
            if (name == g_app_tab_names[i]) {
                return SelectTabEvent{.which = (TabId)i};
            }
        }
        return SelectTabEvent{.which = eTabIdCount};
    }

    const char * SelectTabEvent::tabName(TabId id) {
        return g_app_tab_names[id];
    }
}

#define SHARED_EVENT(T) \
template struct dexode::eventbus::internal::type_id_ptr<T>

SHARED_EVENT(AppEvent::TagEvent);
SHARED_EVENT(AppEvent::ItemEvent);
SHARED_EVENT(AppEvent::IssueEvent);
SHARED_EVENT(AppEvent::ActivityEvent);
SHARED_EVENT(AppEvent::AppConfigEvent);
SHARED_EVENT(AppEvent::FontEvent);
SHARED_EVENT(AppEvent::StyleEvent);
SHARED_EVENT(AppEvent::TemplateChangedEvent);
SHARED_EVENT(AppEvent::TaskInfoChanged);
SHARED_EVENT(AppEvent::DialogMessage);
SHARED_EVENT(AppEvent::StatusMessage);
SHARED_EVENT(AppEvent::AppUpgradeEvent);
SHARED_EVENT(AppEvent::CreateDiaryItemEvent);
SHARED_EVENT(AppEvent::SelectTabEvent);
SHARED_EVENT(AppEvent::FillByMainlineTaskEvent);
SHARED_EVENT(AppEvent::QuickShowStatisticsEvent);
SHARED_EVENT(AppEvent::ShowStatisticsByRangeEvent);
SHARED_EVENT(AppEvent::CopyTextEvent);
SHARED_EVENT(AppEvent::SurveyEvent);
SHARED_EVENT(AppEvent::RespondEvent);

#undef SHARED_EVENT
